package com.gl.saasservice.approvalprocess.repository;

import com.gl.saasservice.approvalprocess.entity.ApprovalProcessUser;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

public interface ApprovalProcessUserRepository extends PagingAndSortingRepository<ApprovalProcessUser, Long>, JpaSpecificationExecutor<ApprovalProcessUser>, JpaRepository<ApprovalProcessUser,Long> {
    ApprovalProcessUser findByApprovalProcessIdAndApprovalProcessNodeIdAndAuditorUserId(Long approvalProcessId, Long approvalProcessNodeId, String auditorUserId);
    @Transactional
    void deleteByApprovalProcessId(Long approvalProcessId);
    List<ApprovalProcessUser> findByApprovalProcessIdAndApprovalProcessNodeId(Long approvalProcessId, Long approvalProcessNodeId);
    ApprovalProcessUser findByApprovalProcessIdAndApprovalProcessNodeIdAndOrgId(Long approvalProcessId, Long approvalProcessNodeId, Long orgId);

    ApprovalProcessUser findByOrgId(Long orgId);

}
